package com.xiangshizhineng.tianzhangzhi.app.controller;


import com.xiangshizhineng.tianzhangzhi.app.common.R;
import com.xiangshizhineng.tianzhangzhi.app.filter.AppToken;
import com.xiangshizhineng.tianzhangzhi.app.model.response.NoticeResponse;
import com.xiangshizhineng.tianzhangzhi.app.service.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/notice")
@Slf4j
@Api(tags="公告管理")
public class NoticeController {
    @Autowired
    NoticeService noticeService;

    @ApiOperation(value = "首页公告详情", notes = "点击列表进入具体公告详情")
    @ApiImplicitParam(name = "id", value = "公告id", dataType = "Long", paramType = "query", required = true)
    @GetMapping("/noticeDetails")
    @AppToken
    public R<NoticeResponse> noticeDetails(Long id){
        NoticeResponse noticeResponse = noticeService.getById(id);
        return R.success(noticeResponse);
    }
}
